package com.blank.task18;

import java.util.List;

public class addStudent {
    public static void add(int stuNum, String name, int age, List<Student> studentList)  {
        Student stu = null;
        try {
            stu = new Student(stuNum,name,age);
        } catch (AgeException e) {
            e.printStackTrace();
        } catch (StuNumException e) {
            e.printStackTrace();
        }
        boolean flag = studentList.contains(stu);
        if(flag){
            System.out.println("该学生已经存在，请重新添加！");
        }else{
            studentList.add(stu);
            System.out.println("添加成功！");
        }
    }
}
